# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
# Maintainer: Holger Jaekel <holger.jaekel@gmx.de>
pkgname=cfitsio
pkgver=4.4.0
pkgrel=0
pkgdesc="Library reading and writing data files in Flexible Image Transport System data format"
url="https://heasarc.gsfc.nasa.gov/fitsio/"
arch="all"
license="NASA-1.3"
makedepends="
	bzip2-dev
	curl-dev
	gfortran
	"
subpackages="
	$pkgname-static
	$pkgname-dev
	"
source="https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-$pkgver.tar.gz
	10-OFF_T.patch
	"

build() {
	./configure \
		--prefix=/usr \
		--with-bzip2 \
		--enable-reentrant \
		--enable-sse2 \
		--enable-hera
	make shared
	make utils
}

package() {
	make DESTDIR="$pkgdir" install

	# delete test/demo programs
	rm "$pkgdir"/usr/bin/testprog
	rm "$pkgdir"/usr/bin/cookbook

	# avoid conflicts with smem
	rm "$pkgdir"/usr/bin/smem
}

check() {
	LD_LIBRARY_PATH=. ./testprog > testprog.lis
	[ -z "$(diff testprog.lis testprog.out)" ]
	[ -z "$(cmp testprog.fit testprog.std)" ]
}

sha512sums="
9358b1ed94fdc456cf8c0ddcb346c08f6bc97ee862c31366f3fae2d1be8d5278ffc79da01e41ceebf67ebc831f58bce3551e087c883bbf6b396133110d74b076  cfitsio-4.4.0.tar.gz
4a1cf7cf6f7dbd44c91d8f0b7de5792b83786ffcb3e18188e1ed82c00fda420613e7442b7497d3867bcd6695438ce660ebf7563a60dfc4f48a3807712a69f7ec  10-OFF_T.patch
"
